using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class playercreateinfo_spell : MangosBase
	{
		public System.Byte? race;
		public System.Byte? class_;
		public System.UInt32? spell;
		public System.String note;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `playercreateinfo_spell` (`race`, `class`, `spell`, `note`) VALUES ('{0}', '{1}', '{2}', '{3}');", race.GetValueOrDefault(), class_.GetValueOrDefault(), spell.GetValueOrDefault(), note.MySQLDBString());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `playercreateinfo_spell` SET ");
			if(class_ != null)
			{
				sb.AppendLine("`class`='" + class_.Value.ToString() + "'");
			}
			if(spell != null)
			{
				sb.AppendLine("`spell`='" + spell.Value.ToString() + "'");
			}
			if(note != null)
			{
				sb.AppendLine("`note`='" + note.MySQLDBString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `race`='" + race.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
